<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">
<ui:composition template="../templates/layout.xhtml">
	<ui:define name="content">
		<h:form prependId="false" id="growlForm">
			<p:growl id="growl" showDetail="false" />
		</h:form>
		<h:form prependId="false" id="dataForm">
			<p:panel id="data" toggleable="true" toggleSpeed="250">
				<f:facet name="header">
					<h:outputText value="#{messages.label_managegroups_header}" />
				</f:facet>
				<h:panelGrid columns="1" width="100%">
					<h:outputFormat id="noRecordsFound"
						value="#{messages.label_no_records_found}"
						rendered="#{!categoryGroupBean.dataVisible}">
						<f:param value="CategoryGroups" />
					</h:outputFormat>
					<p:dataTable id="list"
						value="#{categoryGroupBean.allCategoryGroups}" var="categoryGroup" 
						rendered="#{categoryGroupBean.dataVisible}"
						resizableColumns="false" paginator="true"
						paginatorTemplate=" {CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
						rowsPerPageTemplate="5,10,25,50" rows="10">
						<p:columns value="#{categoryGroupBean.columns}" var="column"
							columnIndexVar="colIndex">
							<f:facet name="header">
								<h:outputText value="#{applicationBean.getColumnName(column)}" />
							</f:facet>
							<h:outputText value="#{categoryGroup[column]}" />
						</p:columns>
						<p:column styleClass="action-column">
							<f:facet name="header">
								<h:outputText value="Actions" />
							</f:facet>
							<p:commandButton id="viewButton" icon="ui-icon-zoomin"
								action="#{categoryGroupBean.displayCategoryGroup}"
								update=":categoryPatternDataForm:categoryPatternData"
								oncomplete="categoryPatternDialogWidget.show()"
								title="#{messages.label_pattern}">
								<f:setPropertyActionListener value="#{categoryGroup}"
									target="#{categoryPatternBean.categoryGroup}" />
								<f:setPropertyActionListener value="#{categoryGroup}"
									target="#{categoryGroupBean.categoryGroup}" />
							</p:commandButton>
							<p:tooltip for="viewButton" value="#{messages.label_pattern}"
								showEffect="fade" hideEffect="fade" />
							<p:commandButton id="editButton" icon="ui-icon-pencil"
								update=":editForm:editPanelGrid"
								action="#{categoryGroupBean.onEdit}"
								oncomplete="editDialogWidget.show()"
								title="#{messages.label_edit}">
								<f:setPropertyActionListener value="#{categoryGroup}"
									target="#{categoryGroupBean.categoryGroup}" />
							</p:commandButton>
							<p:tooltip for="editButton" value="#{messages.label_edit}"
								showEffect="fade" hideEffect="fade" />
							<p:commandButton id="deleteButton" icon="ui-icon-trash"
								oncomplete="deleteDialogWidget.show()"
								title="#{messages.label_delete}">
								<f:setPropertyActionListener value="#{categoryGroup}"
									target="#{categoryGroupBean.categoryGroup}" />
							</p:commandButton>
							<p:tooltip for="deleteButton" value="#{messages.label_delete}"
								showEffect="fade" hideEffect="fade" />
						</p:column>
					</p:dataTable>
					<p:spacer width="10" height="15" />
					<p:commandButton id="createCategoryGroupButton"
						value="#{messages.label_create}"
						action="#{categoryGroupBean.displayCreateDialog}"
						oncomplete="createDialogWidget.show()"
						update="data :growlForm:growl" />
				</h:panelGrid>
			</p:panel>
		</h:form>
		<p:dialog id="createDialog"
			header="#{messages.label_create} #{messages.label_categorygroups}"
			modal="true" widgetVar="createDialogWidget" dynamic="true"
			resizable="true" maximizable="true" showEffect="fade"
			hideEffect="explode">
			<p:ajax event="close" update=":dataForm:data"
				listener="#{categoryGroupBean.handleDialogClose}" />
			<p:outputPanel id="createPanel">
				<h:form id="createForm" enctype="multipart/form-data">
					<h:panelGrid id="createPanelGrid" columns="3"
						binding="#{categoryGroupBean.createPanelGrid}" styleClass="dialog"
						columnClasses="col1,col2,col3" />
					<p:commandButton id="createSaveButton"
						value="#{messages.label_save}"
						action="#{categoryGroupBean.persist}"
						update="createPanelGrid :growlForm:growl" />
					<p:commandButton id="createCloseButton"
						value="#{messages.label_close}"
						onclick="createDialogWidget.hide()" type="button" />
				</h:form>
			</p:outputPanel>
		</p:dialog>
		<p:dialog id="editDialog"
			header="#{messages.label_edit} #{messages.label_categorygroups}"
			modal="true" widgetVar="editDialogWidget" dynamic="true"
			resizable="true" maximizable="true" showEffect="fade"
			hideEffect="explode">
			<p:ajax event="close" update=":dataForm:data"
				listener="#{categoryGroupBean.handleDialogClose}" />
			<p:outputPanel id="editPanel">
				<h:form id="editForm" enctype="multipart/form-data">
					<h:panelGrid id="editPanelGrid" columns="3"
						binding="#{categoryGroupBean.editPanelGrid}" styleClass="dialog"
						columnClasses="col1,col2,col3" />
					<p:commandButton id="editSaveButton" value="#{messages.label_save}"
						action="#{categoryGroupBean.persist}"
						update="editPanelGrid :growlForm:growl" />
					<p:commandButton id="editCloseButton"
						value="#{messages.label_close}" onclick="editDialogWidget.hide()"
						type="button" />
				</h:form>
			</p:outputPanel>
		</p:dialog>
		<p:dialog id="viewDialog"
			header="#{messages.label_view} #{messages.label_categorygroups}"
			modal="true" widgetVar="viewDialogWidget" dynamic="true"
			resizable="true" maximizable="true" showEffect="fade"
			hideEffect="explode">
			<p:outputPanel id="viewPanel">
				<h:form id="viewForm" enctype="multipart/form-data">
					<h:panelGrid id="viewPanelGrid" columns="2"
						binding="#{categoryGroupBean.viewPanelGrid}" styleClass="dialog"
						columnClasses="col1,col2" />
					<p:commandButton id="viewCloseButton"
						value="#{messages.label_close}" onclick="viewDialogWidget.hide()"
						type="button" />
				</h:form>
			</p:outputPanel>
		</p:dialog>
		<p:confirmDialog id="deleteDialog" widgetVar="deleteDialogWidget"
			message="#{messages.label_delete_record}" showEffect="fade"
			hideEffect="explode" header="#{messages.label_confirm_deletion}"
			severity="alarm">
			<p:outputPanel id="deletePanel">
				<h:form id="deleteForm">
					<p:commandButton id="deleteYesButton" value="#{messages.label_yes}"
						action="#{categoryGroupBean.delete}"
						update=":dataForm:data :growlForm:growl"
						oncomplete="deleteDialogWidget.hide()" />
					<p:commandButton id="deleteNoButton" value="#{messages.label_no}"
						onclick="deleteDialogWidget.hide()" type="button" />
				</h:form>
			</p:outputPanel>
		</p:confirmDialog>
		<p:dialog id="categoryPatternDialog"
			header="#{messages.label_pattern}" modal="true"
			widgetVar="categoryPatternDialogWidget" dynamic="true"
			resizable="true" maximizable="true" showEffect="fade"
			hideEffect="explode" appendToBody="true">
			<h:form prependId="false" id="categoryPatternDataForm">
				<h:panelGrid id="categoryPatternData" columns="1">
					<h:outputText
						value="#{messages.label_pattern_for_group} #{categoryGroupBean.categoryGroup.name}" />
					<h:outputFormat id="noPatternsFound"
						value="#{messages.label_no_records_found}"
						rendered="#{!categoryPatternBean.dataVisible}">
						<f:param value="CategoryPatterns" />
					</h:outputFormat>
					<h:panelGrid columns="1">
						<p:dataTable id="categoryPatternList"
							value="#{categoryPatternBean.allCategoryPatterns}"
							var="categoryPattern"
							rendered="#{categoryPatternBean.dataVisible}"
							resizableColumns="false" paginator="true"
							paginatorTemplate=" {CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
							rowsPerPageTemplate="5,10,25,50" rows="10">
							<p:columns value="#{categoryPatternBean.columns}" var="column"
								columnIndexVar="colIndex">
								<f:facet name="header">
									<h:outputText value="#{applicationBean.getColumnName(column)}" />
								</f:facet>
								<h:outputText value="#{categoryPattern[column]}" />
							</p:columns>
							<p:column styleClass="action-column">
								<f:facet name="header">
									<h:outputText value="Actions" />
								</f:facet>
								<p:commandButton id="editCategoryPatternButton"
									icon="ui-icon-pencil"
									update=":categoryPatternEditForm:editPanelGrid"
									action="#{categoryPatternBean.onEdit}"
									oncomplete="categoryPatternEditDialogWidget.show()"
									title="#{messages.label_edit}">
									<f:setPropertyActionListener value="#{categoryPattern}"
										target="#{categoryPatternBean.categoryPattern}" />
								</p:commandButton>
								<p:tooltip for="editCategoryPatternButton"
									value="#{messages.label_edit}" showEffect="fade"
									hideEffect="fade" />
								<p:commandButton id="deleteCategoryPatternButton"
									icon="ui-icon-trash"
									oncomplete="categoryPatternDeleteDialogWidget.show()"
									title="#{messages.label_delete}">
									<f:setPropertyActionListener value="#{categoryPattern}"
										target="#{categoryPatternBean.categoryPattern}" />
								</p:commandButton>
								<p:tooltip for="deleteCategoryPatternButton"
									value="#{messages.label_delete}" showEffect="fade"
									hideEffect="fade" />
							</p:column>
						</p:dataTable>


					</h:panelGrid>
					<p:spacer width="10" height="15" />
					<h:panelGrid columns="4">
						<p:commandButton id="createCategoryPatternButton"
							action="#{categoryPatternBean.displayCreateDialog}"
							icon="ui-icon-document" update=":viewForm:viewPanelGrid"
							value="#{messages.label_create}"
							oncomplete="categoryPatternCreateDialogWidget.show()"
							title="#{messages.label_create}">
						</p:commandButton>
						<p:tooltip for="createCategoryPatternButton"
							value="#{messages.label_create}" showEffect="fade"
							hideEffect="fade" />
						<p:commandButton id="categoryPatternDialogCloseButton"
							value="#{messages.label_close}"
							onclick="categoryPatternDialogWidget.hide()" type="button" />
						<p:tooltip for="categoryPatternDialogCloseButton"
							value="#{messages.label_close}" showEffect="fade"
							hideEffect="fade" />
					</h:panelGrid>
				</h:panelGrid>
			</h:form>
		</p:dialog>
		<p:dialog id="categoryPatternCreateDialog"
			header="#{messages.label_create} CategoryPattern" modal="true"
			widgetVar="categoryPatternCreateDialogWidget" dynamic="true"
			visible="#{categoryPatternBean.createDialogVisible}" resizable="true"
			maximizable="true" showEffect="fade" hideEffect="explode"
			appendToBody="true">
			<p:ajax event="close" update=":dataForm:data"
				listener="#{categoryPatternBean.handleDialogClose}" />
			<p:outputPanel id="categoryPatternCreatePanel">
				<h:form id="categoryPatternCreateForm" enctype="multipart/form-data">
					<h:panelGrid id="createPanelGrid" columns="3"
						binding="#{categoryPatternBean.createPanelGrid}"
						styleClass="dialog" columnClasses="col1,col2,col3" />
					<p:commandButton id="createSaveButton"
						value="#{messages.label_save}"
						action="#{categoryPatternBean.persist}"
						update=":categoryPatternDataForm:categoryPatternData :growlForm:growl"
						oncomplete="categoryPatternCreateDialogWidget.hide()" />
					<p:commandButton id="createCloseButton"
						value="#{messages.label_close}"
						onclick="categoryPatternCreateDialogWidget.hide()" type="button" />
				</h:form>
			</p:outputPanel>
		</p:dialog>
		<p:dialog id="categoryPatternEditDialog"
			header="#{messages.label_edit} CategoryPattern" modal="true"
			widgetVar="categoryPatternEditDialogWidget" dynamic="true"
			resizable="true" maximizable="true" showEffect="fade"
			hideEffect="explode" appendToBody="true">
			<p:ajax event="close"
				update=":categoryPatternDataForm:categoryPatternData :dataForm:data"
				listener="#{categoryPatternBean.handleDialogClose}" />
			<p:outputPanel id="categoryPatternEditPanel">
				<h:form id="categoryPatternEditForm" enctype="multipart/form-data">
					<h:panelGrid id="editPanelGrid" columns="3"
						binding="#{categoryPatternBean.editPanelGrid}" styleClass="dialog"
						columnClasses="col1,col2,col3" />
					<p:commandButton id="editSaveButton" value="#{messages.label_save}"
						action="#{categoryPatternBean.persist}"
						update=":categoryPatternDataForm:categoryPatternData :growlForm:growl"
						oncomplete="categoryPatternEditDialogWidget.hide()" />
					<p:commandButton id="editCloseButton"
						value="#{messages.label_close}"
						onclick="categoryPatternEditDialogWidget.hide()" type="button" />
				</h:form>
			</p:outputPanel>
		</p:dialog>
		<p:dialog id="categoryPatternViewDialog"
			header="#{messages.label_view} CategoryPattern" modal="true"
			widgetVar="categoryPatternViewDialogWidget" dynamic="true"
			resizable="true" maximizable="true" showEffect="fade"
			hideEffect="explode" appendToBody="true">
			<p:outputPanel id="categoryPatternViewPanel">
				<h:form id="categoryPatternViewForm" enctype="multipart/form-data">
					<h:panelGrid id="viewPanelGrid" columns="2"
						binding="#{categoryPatternBean.viewPanelGrid}" styleClass="dialog"
						columnClasses="col1,col2" />
					<p:commandButton id="viewCloseButton"
						value="#{messages.label_close}"
						onclick="categoryPatternViewDialogWidget.hide()" type="button" />
				</h:form>
			</p:outputPanel>
		</p:dialog>
		<p:confirmDialog id="categoryPatternDeleteDialog"
			widgetVar="categoryPatternDeleteDialogWidget"
			message="#{messages.label_delete_record}" showEffect="fade"
			hideEffect="explode" header="#{messages.label_confirm_deletion}"
			severity="alarm" appendToBody="true">
			<p:outputPanel id="categoryPatternDeletePanel">
				<h:form id="categoryPatternDeleteForm">
					<p:commandButton id="deleteYesButton" value="#{messages.label_yes}"
						action="#{categoryPatternBean.delete}"
						update=":categoryPatternDataForm:categoryPatternData :growlForm:growl"
						oncomplete="categoryPatternDeleteDialogWidget.hide()" />
					<p:commandButton id="deleteNoButton" value="#{messages.label_no}"
						onclick="categoryPatternDeleteDialogWidget.hide()" type="button" />
				</h:form>
			</p:outputPanel>
		</p:confirmDialog>
	</ui:define>
</ui:composition>
</html>